home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / sound / vdigit.zip / EMBEDDED.C < prev    next >
C/C++ Source or Header  |  1989-06-24  |  2KB  |  71 lines

  1. /****************************************************************/
  2. /*                                                              */
  3. /*          Digitized Voice Programmer's Toolkit                */
  4. /*          ------------------------------------                */
  5. /*                                                              */
  6. /*      Example of a program with embedded voice data           */
  7. /*                                                              */
  8. /*          Copyright (c) 1989, Farpoint Software               */
  9. /*                                                              */
  10. /*                                                              */
  11. /*  This program simply plays a voice message while displaying  */
  12. /*  a message repeatedly indicating the count of bytes played.  */
  13. /*  The digitized voice data is embedded in the EXE file rather */
  14. /*  than being read from a separate file. Study the "make" file */
  15. /*  named EMBEDDED to see how the EXE file was created.         */
  16. /*                                                              */
  17. /****************************************************************/
  18.  
  19. #include "vpmod.h"
  20.  
  21. #include <stdlib.h>
  22. #include <stdio.h>
  23. #include <bios.h>
  24.  
  25. extern unsigned char EVMSG;
  26. extern unsigned char EVMSGLEN;
  27.  
  28. main(argc,argv)
  29. int argc;
  30. char **argv;
  31.  
  32. {
  33. long count,index;
  34.  
  35. PVOICE_INIT();
  36.  
  37. PVOICE_START(&EVMSG,(long)(&EVMSGLEN - &EVMSG),0,0,(long)(&EVMSGLEN - &EVMSG),0L);
  38. printf("Voice playback has begun.\n");
  39.  
  40. /* loop until done */
  41. /* if PVOICE_STATUS returns zero then playback is done */
  42.  
  43. while (PVOICE_STATUS(&count,&index))
  44.     {
  45.  
  46.     /* displaying messages is just something to do in the foreground */
  47.  
  48.     printf("Number of bytes played = %ld\n",count);
  49.  
  50.     /* check the keystroke buffer */
  51.  
  52.     if (_bios_keybrd(_KEYBRD_READY))
  53.         {
  54.  
  55.         /* a key was pressed, see if it is the <Esc> key */
  56.  
  57.         if ( (_bios_keybrd(_KEYBRD_READ) >> 8) == 0x01 )
  58.             {
  59.             PVOICE_STOP();
  60.             printf("Voice playback stopped with <Esc>\n");
  61.             break;
  62.             }
  63.         }
  64.     }
  65.  
  66. /* do this before exiting or die later */
  67.  
  68. PVOICE_CLEANUP();
  69.  
  70. }
  71.